#include "gamekit/scripting/Invocation.h"
#include "gamekit/scripting/Arguments.h"
#include "gamekit/scripting/Result.h"

using namespace gamekit;
using namespace gamekit::scripting;

Invocation::Invocation(lua_State* state, Delegate<Result, Arguments> delegate)
	: m_state(state),
	  m_delegate(delegate)
{
}

Invocation::~Invocation()
{
}

uint Invocation::exec(void)
{
	Arguments args(m_state);
	Result r = m_delegate.Invoke(args);
	uint count = r.Process(m_state);
	return count;
}
